package org.dinner.order.service.impl;

import java.util.List;

import org.dinner.order.dao.OrderItemDAO;
import org.dinner.order.model.OrderItem;
import org.dinner.order.service.OrderItemService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service
public class OrderItemServiceImpl implements OrderItemService {
	@Autowired
	private OrderItemDAO orderItemDAO;
	
	@Transactional
	public OrderItem add(OrderItem item) {
		return orderItemDAO.add(item);
	}

	@Transactional
	public List<OrderItem> list() {
		return orderItemDAO.list();
	}

	@Transactional
	public OrderItem getById(int id) {
		return orderItemDAO.getById(id);
	}

	@Transactional
	public void remove(int id) {
		orderItemDAO.remove(id);
	}
	
	@Transactional
	public List<OrderItem> listByUserId(int userId) {
		return orderItemDAO.listByUserId(userId);
	}

}
